module BillHelper
 
  # Override text_field_tag method in order to add a default class
  def text_field_tag(*args)
    # Check options hash
    args = check_options_hash(args)
    # Append class name to string
    args.last[:class] += 'textfield'
    super(*args)
  end
 
  # Used by overridden form helpers above
  def check_options_hash(args)
    # Make sure an options hash exists
    unless args.last.kind_of?(Hash)  
      args << {}  
    end
    # Make sure :class key exists in hash, append space if it does
    if args.last.include?(:class)
      args.last[:class] += ' '
    else
      args.last[:class] = ''
    end
    return args
  end
 
end